package com.wt.chat.query;

/**
 * @description
 * @author: wangtao
 * @date:16:32 2019/11/12
 * @email:taow02@jumei.com
 */
public class PageQuery {

	private Integer pageNo;

	private Integer pageSize;

	private Integer start;

	private Integer end;

	/**
	 * total count
	 */
	private int totalCount = -1;

	public PageQuery() {

	}

	public PageQuery(int pageNo, int pageSize) {
		this.pageNo = pageNo;
		this.pageSize= pageSize;

		if (pageNo == 1) {
			this.start = 0;
		} else {
			this.start = (pageNo - 1) * pageSize;
		}

		this.end = this.start + pageSize - 1;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public PageQuery setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
		return this;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public PageQuery setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
		return this;
	}

	public Integer getStart() {
		return start;
	}

	public PageQuery setStart(Integer start) {
		this.start = start;
		return this;
	}

	public Integer getEnd() {
		return end;
	}

	public PageQuery setEnd(Integer end) {
		this.end = end;
		return this;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public PageQuery setTotalCount(int totalCount) {
		this.totalCount = totalCount;
		return this;
	}
}
